package com.auxgroup.hr.front.service.modperson.impl;

import java.util.List;

import com.auxgroup.hr.front.service.hireperson.impl.HireEducatServiceImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Example;
import org.springframework.stereotype.Service;

import com.auxgroup.hr.front.commons.utils.ObjectFieldUtils;
import com.auxgroup.hr.front.dao.domain.PsCModPersData;
import com.auxgroup.hr.front.dao.repository.PsCModPersDataRepository;
import com.auxgroup.hr.front.service.modperson.ModPersService;

/** 
 * @author lvliuhao
 * @version 创建时间：180526 
 * 奖惩情况流程信息service
 */
@Service("modPersService")
public class ModPersServiceImpl implements ModPersService {
	private static final Logger logger = LoggerFactory.getLogger(HireEducatServiceImpl.class);
	
	@Autowired
	private PsCModPersDataRepository PsCModPersDataRepository;


	@Override
	public PsCModPersData getModPers(String transNum) {
		return PsCModPersDataRepository.findOne(transNum);
	}


	@Override
	public PsCModPersData save(PsCModPersData ModPers) {
		ObjectFieldUtils.handleNullValue(ModPers);
		return PsCModPersDataRepository.save(ModPers);
	}


	@Override
	public Boolean delete(String transNum) {
		try {
			PsCModPersDataRepository.delete(transNum);
		} catch (Exception e) {
			logger.error("delete ModPers error: modPersPrimary={}",transNum,e);
			return false;
		}
		return true;
	}
	
	
	@Override
	public List<PsCModPersData> getAll(String emplid) {
		PsCModPersData ModPers = new PsCModPersData();
		ModPers.setEmplid(emplid);
		return PsCModPersDataRepository.findAll(Example.of(ModPers));
	}


	
	
	
}
